        // 导航栏切换
        // let director_item=document.getElementsByClassName('director_item');
        // let temp=0;
        // let canvas=document.getElementById('canvas');
        // let banner_item=document.getElementsByClassName('banner_item');
        // director_item[temp].style.backgroundColor='#2F4399';
        // banner_item[temp].style.display='block';
        // document.getElementById("director").addEventListener("click",(event)=>{
        //     if([...director_item].includes(event.target)){
        //         director_item[temp].style.backgroundColor='transparent';
        //         banner_item[temp].style.display='none';
        //         event.target.style.backgroundColor='#2F4399';
        //         temp=[...director_item].indexOf(event.target);
        //         banner_item[temp].style.display='block';
        //     }
        // });
        // function draw(start_x,start_y,end_x,end_y){
        //     if (!canvas.getContext) return;
        //     let ctx = canvas.getContext("2d");
        //     ctx.beginPath(); 
        //     ctx.strokeStyle="#ffffff";
        //     ctx.lineWidth="3";
        //     ctx.moveTo(start_x, start_y); 
        //     ctx.lineTo(end_x, end_y);
        //     ctx.closePath();
        //     ctx.stroke();
        // }
        // draw(0,0,400,300);
        // draw(1399,0,999,300);
        // draw(0,1039,400,739);
        // draw(1399,1039,999,739);
        // function drawText(){
        //     if (!canvas.getContext) return;
        //     ctx = canvas.getContext("2d");
        //     ctx.fillStyle="#ffffff";
        //     canvas.style.letterSpacing="7px";
        //     ctx.font = "36px sans-serif";
        //     ctx.fillText("banner", 632, 502);
        // }
        // drawText();


        // 两个弹窗
        let login = document.getElementsByClassName('login');
        let register = document.getElementsByClassName('register');
        // 按钮
        let login_enter = document.getElementById('login_enter');
        let res_enter = document.getElementById('res_enter');
        let login_res_btn = document.getElementById('login_res_btn');
        let login_btn = document.getElementById('login_button');
        let res_btn = document.getElementById('register_btn');
        let lclose = document.getElementById('lclose');
        let rclose = document.getElementById('rclose');
        // 提示信息
        let err_account_empty= document.getElementsByClassName('err_account_empty')
        let err_password_empty = document.getElementsByClassName('err_password_empty')
        let log_prompt = document.querySelector('.log_prompt')
        let res_prompt = document.querySelector('.res_prompt')
        // 输入内容
        // 使用value获取输入内容时，当使用类名获取元素，该方法为undefined；改为querySelector，生效
        let log_account = document.querySelector('.log_account')
        let log_pwd = document.querySelector('.log_pwd')
        let rusername = document.querySelector('.rusername')
        let rgender = document.querySelector('.rgender')
        let rdirection = document.querySelector('.rdirection')
        let rterm = document.querySelector('.rterm')
        let invite_code = document.querySelector('.invite_code')
        let rphone_num = document.querySelector('.rphone_num')
        let rpassword = document.querySelector('.rpassword')
        let confirm_rpassword = document.querySelector('.confirm_rpassword')


        // 首页
        login_enter.onclick = function(){
            for (let i = 0; i<register.length;i++){
                register[i].style.display='none'
            }
            for (let i = 0; i<login.length;i++){
                login[i].style.display='block'
            }
        }
        res_enter.onclick = function(){
            for (let i = 0; i<login.length;i++){
                login[i].style.display='none'
            }
            for (let i = 0; i<register.length;i++){
                register[i].style.display='block'
            }
        }


        // 登录
        lclose.onclick = function(){
            for (let i = 0; i<login.length;i++){
                login[i].style.display='none'
            }
        }
        login_res_btn.onclick = function(){
            for (let i = 0; i<login.length;i++){
                login[i].style.display='none'
            }
            for (let i = 0; i<register.length;i++){
                register[i].style.display='block'
            }
        }
        login_btn.onclick = function(){
            if((log_account.value == '' && log_pwd.value == '') || (log_account.value == '' && log_pwd.value != '')){
                for (let i = 0; i<err_account_empty.length;i++){
                    err_account_empty[i].style.display='block'
                };
                setTimeout(function(){
                    for (let i = 0; i<err_account_empty.length;i++){
                        err_account_empty[i].style.display='none'
                    }
                },3000);
            }else if(log_pwd.value == '' && log_account.value != ''){
                for (let i = 0; i<err_password_empty.length;i++){
                    err_password_empty[i].style.display='block'
                }
                setTimeout(function(){
                    for (let i = 0; i<err_password_empty.length;i++){
                        err_password_empty[i].style.display='none'
                    }
                },3000);
            }
            else{
                // let log_param = new URLSearchParams()
                // log_param.append('phone_name', log_account.value)
                // log_param.append('password', log_pwd.value)
                axios({
                    method:'POST',
                    url:'http://jp-tyo-ntt-1.natfrp.cloud:27062//test001_war_exploded/LoginServlet',
                    headers: {'Content-Type': 'application/json'},
                    data: {
                        "phone_num":log_account.value,
                        "password":`${log_pwd.value}`,
                    }
                    // data: log_param
                })
                .then(result => {
                    // alert(result.data.msg);
                    log_prompt.innerHTML = `${result.data.msg}`
                    log_prompt.style.display='block'
                    console.log("登录用户报文",result)
                    setTimeout(function(){
                        log_prompt.style.display='none'},3000);
                })
                .catch(()=>{
                    console.log("出错了！")
                })
                
            }
        }


        // 注册
        rclose.onclick = function(){
            for (let i = 0; i<register.length;i++){
                register[i].style.display='none'
            }
        }
        res_btn.onclick = function(){
            // res_btn.disabled=true;
            // 此处本有姓名密码未输入时按钮禁用的功能，实现存在问题，改为弹窗提示
            let reg=/^(?=.*[0-9])(?=.*[a-zA-Z])([a-zA-Z0-9]{8,18})$/
            if(rusername.value=='' && rpassword==''){
                res_prompt.innerHTML = '输入为空，请重新输入哦'
                res_prompt.style.display='block'
                setTimeout(function(){
                    res_prompt.style.display='none'},3000);
            }else if (reg.test(rpassword.value) === false){
                // alert('密码格式有误，请重新输入')
                res_prompt.innerHTML = '密码格式有误，请重新输入哦'
                res_prompt.style.display='block'
                setTimeout(function(){
                    res_prompt.style.display='none'},3000);
            }else if(rpassword.value != confirm_rpassword.value){
                // alert('两次输入的密码不相符，请重新输入')
                res_prompt.innerHTML = '两次输入的密码不相符，请重新输入哦'
                res_prompt.style.display='block'
                setTimeout(function(){
                    res_prompt.style.display='none'},3000);
            }
            // else if(rusername.value !='' && rpassword.value !=''){
            //     res_btn.disabled=false;
            // }
            else {
                axios({
                    method:'POST',
                    url:'http://jp-tyo-ntt-1.natfrp.cloud:27062//test001_war_exploded/EnrollServlet',
                    headers: {'Content-Type': 'application/json'},
                    data: {
                        phone_num: rphone_num.value,
                        password: rpassword.value,
                        username: rusername.value,
                        gender: rgender.value,
                        term: rterm.value,
                        direction: rdirection.value,
                        invite_code: invite_code.value
                    }
                })
                .then(result => {
                    res_prompt.innerHTML = `${result.data.msg}`
                    res_prompt.style.display='block'
                    setTimeout(function(){
                        res_prompt.style.display='none'},3000);
                    console.log("注册用户报文",result)
                })
                .catch(()=>{
                    console.log("出错了！")
                })
            }

        }